package zisu.netty.practice.netty.inBoundAndOutBound;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

/**
 * @Desc: ""
 * @Author: caixiang
 * @DATE: 2020/7/29 11:36
 */
public class MyLongToByteEncoder extends MessageToByteEncoder<Long> {
    //编码方法
    @Override
    protected void encode(ChannelHandlerContext ctx, Long msg, ByteBuf out) throws Exception {
        System.out.println("client-MyLongToByteEncoder - encode方法 被调用，msg:"+msg);
        out.writeLong(msg);
    }
}
